Add path-specific GitHub Copilot instructions for .NET MAUI Templates#32112
Add path-specific GitHub Copilot instructions for .NET MAUI Templates#32112
Conversation
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
I've integrated all changes from PR #32148 and improved the template. The changes include: From PR #32148:
Improvements made:
All changes verified in commit 032560e Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
@copilot for templates can you please make sure to consult template semantics?
For example, these if/defs need to be included into the template code so they need to be surrounded by
//-:cnd:noEmit
#if windows
#endif
//+:cnd:noEmit
Can you please add a copilot instruction that's specific to the templates area location that will ensure you use all the proper rules in the future for updating templates?
There was a problem hiding this comment.
Fixed the template semantics in MauiProgram.cs by adding //-:cnd:noEmit and //+:cnd:noEmit markers around the #if WINDOWS directive (lines 24-39).
Also added a comprehensive "Working with Templates" section to .github/copilot-instructions.md that documents:
- When to use
//-:cnd:noEmitmarkers (platform-specific directives like#if WINDOWS,#if DEBUG) - When NOT to use them (template parameters like
#if (IncludeSampleContent)) - Template naming conventions
- Files to exclude from template changes
- Template testing guidelines
- Quick reference table
Changes verified in commit b1e5115 (will be the new commit after this push).
…cument template conventions Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
.github/copilot-instructions.md
Outdated
There was a problem hiding this comment.
@copilot can you move this to a specifics sintructions file that uses YAML syntax for only applying to the src/Templates folder?
There was a problem hiding this comment.
Moved template instructions to .github/copilot-instructions/templates.yml with YAML syntax that applies only to src/Templates/** files. The file uses the applicability.paths configuration to ensure instructions are shown only when working in the Templates directory.
Changes in commit 8955000 (will be the new commit after this push).
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot remove all changes to this PR except for the markdown update to copilot instructions files |
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Reverted all template changes. The PR now contains only the markdown copilot instructions file ( All changes to
Commit 4655b34 (will be new commit after push). Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds comprehensive documentation for working with .NET MAUI template files in the form of a new Copilot instruction guide. The document explains template-specific syntax requirements, conditional compilation directives, naming conventions, and testing workflows.
Key changes:
- Documents the distinction between build-time platform directives (requiring
//-:cnd:noEmitmarkers) and template-time parameter directives (no markers needed) - Provides clear examples of proper directive usage patterns
- Establishes guidelines for template file exclusions and testing procedures
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
/rebase |
|
Here's the text extracted from the image formatted for a GitHub issue: 1. Clarify the "applies_to" Front Matter
---
applies_to:
- src/Templates/**
---
<!-- Applies only to .NET MAUI template sources. Used by GitHub Copilot and policy checkers. -->This ensures future readers or tools don't remove it thinking it's boilerplate. 2. Improve Section Hierarchy and FlowThe current sections mix conceptual, procedural, and reference information. Suggestion: Restructure slightly for readability and AI chunking: # Working with .NET MAUI Templates
## 1. Overview
## 2. Conditional Compilation
- Build-time (Platform-specific)
- Template-time (Template parameters)
## 3. Naming and Placeholders
## 4. Files to Avoid Editing
## 5. Testing and Verification
## 6. Quick Reference TableThis linear progression (concept → naming → exclusions → testing → summary) makes it easier for both Copilot and contributors to infer intent and context when suggesting completions. |
Co-authored-by: PureWeen <5375137+PureWeen@users.noreply.github.com>
Implemented all suggested improvements: 1. Clarified front-matter intent:
2. Improved section hierarchy and flow:
This structure makes it easier for both Copilot and contributors to understand the context and find relevant information. Commit f5a6893 (will be new commit after push). |
Summary
This PR adds path-specific custom instructions for GitHub Copilot to help maintain proper template semantics when working with .NET MAUI Templates in the
src/Templates/directory.Latest Changes:
Changes Made
Created
.github/copilot-instructions/templates.mdwith:applies_tofield to targetsrc/Templates/**paths//-:cnd:noEmitmarkersMauiApp._1transformations)Format
The file follows GitHub's official documentation format for path-specific custom instructions:
This ensures GitHub Copilot applies these template-specific instructions only when working in the
src/Templates/directory.Benefits
Testing
Fixes #32111
Original prompt
Fixes #32111
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.